package com.shop.loan.model.common;

import lombok.Data;

@Data
public class ResResultByLiHuo {

    private String message;

    private Object data;

    private Integer code;

    public ResResultByLiHuo() {
    }

    public ResResultByLiHuo(Code code) {
        if(code.getCode() == Code.SUCCESS.getCode().intValue()){
            this.code = 0;
        }else{
            this.code = code.getCode();
        }
        this.message = code.getMsg();
    }

    public ResResultByLiHuo(Code code, Object data) {
        if(code.getCode() == Code.SUCCESS.getCode().intValue()){
            this.code = 0;
        }else{
            this.code = code.getCode();
        }
        this.message = code.getMsg();
        this.data = data;
    }


    public ResResultByLiHuo(ResResult resResult) {
        if(resResult.getCode() == Code.SUCCESS.getCode().intValue()){
            this.code = 0;
        }else{
            this.code = resResult.getCode();
        }
        this.message = resResult.getMsg();
        this.data = resResult.getData();
    }

}
